<?php

class models_hang extends connect
{
	function _listhang()
	{
		$sql = 'SELECT MaNCC, TenNCC FROM ncc';
		$this->query_db($sql);
		return $this->fetchAll();
	}
	
	function _addhang($TenNCC)
	{
		$sql = "INSERT INTO ncc VALUE ('','$TenNCC')";
		$this->query_db($sql);
	}
	
	function _delHang($id){
		$sql = "DELETE 
				FROM ncc 
				WHERE MaNCC = $id";
		$this->query_db($sql);
	}
	
	function _getHang($id){
		$sql = "
			SELECT MaNCC, TenNCC
			FROM ncc
			WHERE MaNCC = $id ";
		$this->query_db($sql);
		return $this->fetchOne();
	}
	
	function _updateHang($TenNCC,$id){
		$sql = "
				UPDATE ncc
				SET TenNCC = '$TenNCC'
				WHERE MaNCC = '$id'";
		$this->query_db($sql);
	}
	
}
?>